import { Component, OnInit } from '@angular/core';
import { IHomeHeader } from './home-header/home-header.component';
import { HttpService } from '../../../http/http.service';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: [
    './home.component.less'
   ]
})
export class HomeComponent implements OnInit {
  current = 1;
  hotBaseUrl = '/menu';
  hot = {
    header: {
      subTitle: 'Popular',
      title: '正在热销'
    },
    list: []
  };
  banner = [
    {
      path: '/',
      imgUrl: 'https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-698246.jpg'
    },
    {
      path: '/',
      imgUrl: 'https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-696139.jpg'
    },
    {
      path: '/',
      imgUrl: 'https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-695427.jpg'
    }
  ];
  headerData: IHomeHeader = {
    businessHours: { beginTime: '06:00', endTime: '24:00' },
    address: '南城步行街101号'
  };

  constructor( private http: HttpService ) { }

  ngOnInit() {
    const _this = this;
    this.http.getMenuList().subscribe(data => {
      _this.hot.list  = data as Array<any>;
    });
  }

  change(index) {
    this.current = index;
    console.log('change >>>', index);
  }

}
